package com.xxk.rocket.star.core.client;

import com.alibaba.rocketmq.client.consumer.MQConsumer;
import com.xxk.rocket.star.core.context.AbsProcessContext;
import com.xxk.rocket.star.core.context.ConsumeContext;

public abstract class AbsProcessClientConsume<DTO>
        extends AbsProcessContext<DTO>
        implements IProcessClientConsume {

  protected abstract void processConsume(DTO dto, MQConsumer mqConsumer)
          throws Throwable;

  @Override
  public void processConsumeByContext(ConsumeContext consumeContext, MQConsumer mqConsumer)
          throws Throwable {
    processConsume((DTO) consumeContext.getDTOOrNew(this), mqConsumer);
  }

}
